package com.tensquare.recruit.controller;

import com.tensquare.recruit.pojo.Recruit;
import com.tensquare.recruit.service.RecruitService;
import entity.Result;
import entity.StatusCode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Macross
 * @Type RecruitController.java
 * @Desc
 * @date 2019/12/17 15:39
 */
@RestController
@RequestMapping("/recruit")
@Api(description = "招聘信息管理控制器")
public class RecruitController {

    @Autowired
    private RecruitService recruitService;

    /**
     * 查询职位推荐列表
     * @return 返回查询结果对象,其中包括职位推荐列表
     */
    @GetMapping("/search/recommend")
    @ApiOperation(value = "查询职位推荐信息列表",notes = "仅获取前4条信息")
    public Result<List<Recruit>> recommend(){
        //获取职位推荐列表
        List<Recruit> recruitList = recruitService.recommend();
        //对查询结果进行封装并返回
        return new Result<>(true, StatusCode.OK,"查询成功",recruitList);
    }

    /**
     * 查询最新职位列表
     * @return 返回查询结果对象,其中包括最新职位列表
     */
    @GetMapping("/search/newList")
    @ApiOperation(value = "查询最新职位信息列表",notes = "仅获取前12条信息")
    public Result<List<Recruit>> getNewList(){
        //获取最新职位信息列表
        List<Recruit> recruitList = recruitService.getNewList();
        //将查询结果进行封装并返回
        return new Result<>(true,StatusCode.OK,"查询成功",recruitList);
    }
}
